package com.cndw.kungfu.domain;

import com.cndw.kungfu.config.ConstantsConfig;
import com.cndw.kungfu.model.Context;
import com.cndw.kungfu.vo.UnionMemberVO;

/**
 * 帮派成员实体类
 * 
 * @author <a href="mailto:whz-work@163.com">汪洪州</a>
 * 
 * @since 1.0 Create on 2011-5-18
 */
public class UnionMember {

	/**
	 * 帮派id
	 */
	private int unionId;

	/**
	 * 玩家id
	 */
	private long playerId;

	/**
	 * 玩家职位
	 */
	private int position;

	/**
	 * 附加权限
	 */
	private int flag;

	/**
	 * 贡献度
	 */
	private int resource;

	/**
	 * 历史贡献值
	 */
	private int hissource;

	/**
	 * 加入时间
	 */
	private int addTime;

	/**
	 * 摇钱树领取次数
	 */
	private int counts;

	/**
	 * 摇钱树浇水时间
	 */
	private int waterTime;

	/**
	 * 摇钱树奖励领取时间
	 */
	private int getTime;

	/**
	 * 围城离队时间
	 */
	private int leaveTime;

	public int getUnionId() {
		return unionId;
	}

	public void setUnionId(int unionId) {
		this.unionId = unionId;
	}

	public long getPlayerId() {
		return playerId;
	}

	public void setPlayerId(long playerId) {
		this.playerId = playerId;
	}

	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public int getFlag() {
		return flag;
	}

	public void setFlag(int flag) {
		this.flag = flag;
	}

	public int getAddTime() {
		return addTime;
	}

	public void setAddTime(int addTime) {
		this.addTime = addTime;
	}

	public int getResource() {
		return resource;
	}

	public void setResource(int resource) {
		this.resource = resource;
	}

	public int getHissource() {
		return hissource;
	}

	public void setHissource(int hissource) {
		this.hissource = hissource;
	}

	public int getCounts() {
		return counts;
	}

	public void setCounts(int counts) {
		this.counts = counts;
	}

	public int getWaterTime() {
		return waterTime;
	}

	public void setWaterTime(int waterTime) {
		this.waterTime = waterTime;
	}

	public int getGetTime() {
		return getTime;
	}

	public void setGetTime(int getTime) {
		this.getTime = getTime;
	}

	public int getLeaveTime() {
		return leaveTime;
	}

	public void setLeaveTime(int leaveTime) {
		this.leaveTime = leaveTime;
	}

	public UnionMemberVO toUnionMemberVO() {
		UnionMemberVO memberVO = new UnionMemberVO();
		memberVO.setUnionId(getUnionId());
		memberVO.setUnionName(Context.getUnionServer().getUnionById(getUnionId()).getName());
		memberVO.setPosition(getPosition());
		memberVO.setResource(getResource());
		memberVO.setHissource(getHissource());
		memberVO.setAddTime(getAddTime());
		memberVO.setCounts(getCounts());
		memberVO.setWaterTime(getWaterTime());
		memberVO.setGetTime(getGetTime());
		memberVO.setPermission(ConstantsConfig.getUnionJobsFlag()[getPosition()]);
		memberVO.setFlag(getFlag());

		Player player = Context.getPlayerServer().getByPlayerId(getPlayerId());
		memberVO.setPlayerId(player.getPlayerId());
		memberVO.setPlayerLevel(player.getLevel());
		memberVO.setPlayerName(player.getPlayerName());
		memberVO.setPlayerStatus(player.isOnline());
		memberVO.setPlayerLastLogin(player.getLastLogin());
		memberVO.setOffLineTime(player.getOffLineTime());
		memberVO.setPlayerVocation(player.getVocationId());
		return memberVO;
	}
}
